//
//  SetPasswordViewController.m
//  Student
//
//  Created by 李飞 on 15/9/8.
//  Copyright (c) 2015年 XueYinYue. All rights reserved.
//

#import "SetPasswordViewController.h"
#import "StudentInfoViewController.h"

@interface SetPasswordViewController ()

@end

@implementation SetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"欢迎加入学音悦";
    
    //调整textfield的输入框内输入文字距离
    UIView* passwordPaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 90, _passwordTF.frame.size.height)];
    _passwordTF.leftView = passwordPaddingView;
    _passwordTF.leftViewMode = UITextFieldViewModeAlways;
    
        [self initNavegationBar];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - NavegationBar
- (void)initNavegationBar
{
    
//    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    backBtn.bounds = CGRectMake(0, 0, 15, 20);
//    [backBtn addTarget:self action:@selector(onBackButtonClick:) forControlEvents:UIControlEventTouchUpInside];
//    [backBtn setBackgroundImage:[UIImage imageNamed:NAVIGATION_BACKARROW_IMAGE] forState:UIControlStateNormal];
    
    UIBarButtonItem *backBarBtn = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(onBackButtonClick:)];
    self.navigationItem.leftBarButtonItem = backBarBtn;
}

#pragma mark - 事件处理
- (IBAction)ShowPasswordClick:(id)sender {   
    _passwordTF.secureTextEntry = !_passwordTF.isSecureTextEntry;
}

- (IBAction)OKClick:(id)sender {
    StudentInfoViewController* studentInfoViewController = [[StudentInfoViewController alloc]initWithNibName:@"StudentInfoViewController" bundle:nil];
    [self.navigationController pushViewController:studentInfoViewController animated:YES];
}


- (void)onBackButtonClick:(id)sender
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示：是否返回并放弃注册新用户？" message:nil delegate: self cancelButtonTitle:@"放弃" otherButtonTitles:@"继续注册", nil];
    [alertView show];

}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
    if (buttonIndex == 0) {
        [self.navigationController popViewControllerAnimated:YES];
    }
    else{
        
    }
    
}

@end
